cmake_minimum_required(VERSION 3.10)
project(EchoProject)

# 设置C++标准
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 包含当前目录以找到头文件
include_directories(.)

# 编译服务器程序
add_executable(echo_server
    server_main.cpp
    server.cpp
)
target_link_libraries(echo_server pthread)

# 编译客户端程序
add_executable(echo_client
    client_main.cpp
    client.cpp
)
target_link_libraries(echo_client pthread)

# 可选：设置编译优化（Release模式）
if(CMAKE_BUILD_TYPE STREQUAL "Release")
    add_compile_options(-O2)
endif()